"""
数据路径转换脚本
"""

# 打开原文件和新文件
with open('datasets/FF++_before/train_fake.txt', 'r') as f_in, \
     open('datasets/FF++/train_fake.txt', 'w') as f_out:
    
    for line in f_in:
        # 分割每一行
        parts = line.strip().split(',')
        
        if len(parts) == 3:
            # 获取路径部分
            path = parts[1]
            
            # 去掉.mp4后缀
            path = path.replace('.mp4', '')
            
            # 替换路径前缀
            if 'manipulated_sequenceswap' in path:
                path = path.replace('FF++/manipulated_sequenceswap/', '/mnt/FF++/manipulated_sequences/FaceSwap/')
            else:
                path = path.replace('/data/deepfake/FF++/faces/', '/mnt/FF++/')
            
            # 在c23后添加frames_retina/
            path = path.replace('c23/', 'c23/frames_retina/')
            
            # 重新组合行
            new_line = f"{parts[0]},{path},{parts[2]}\n"
            
            # 写入新文件
            f_out.write(new_line)